package com.zhuhao.design_mode.behavioral_pattern.observer_pattern.java_listener;

import java.util.EventObject;

/**
 * 监听事件：相当于一个实体类用来传输事件状态
 *
 * @Author zhuhao
 * @Date 2022/5/29 21:37
 * @desc
 */
public class MyEventObject extends EventObject {

    /**
     * 相当于重写父类中的构造方法
     * Constructs a prototypical Event.
     *
     * @param source the object on which the Event initially occurred
     * @throws IllegalArgumentException if source is null
     */
    public MyEventObject(Object source) {
        super(source);
    }

    public void doEvent() {
        System.out.println("通知一个事件源 source： " + this.getSource());
    }
}
